<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form enctype="multipart/form-data" method="post" id="upload" role="form">
    openId<input type="text" name="filename" >
    <input type="button" id="but_button" value="上传">
</form>
<script  type="text/javascript">
    var data1 = 'osdn25VzQLVL5gUJa4QHqq8qbHAE'
    var data = new FormData($("#upload")[0]);
    $("#but_button").click(function () {
        console.log(data);
        $.ajax({
            "url": "http://39.104.85.153:8081/getEnvironmentalGuardAllByOpenId",
            "data": data,
            "type": "POST",
            "dataType": "json",
            "success": function (json) {
                if (json.code == 0) {
                    alert("成功")
                } else {
                    alert(json.message)
                }
            },
            "error": function () {
                alert("上传出错")
            }
        })
    })
</script>
</body>
</html>